package me.zhengjie.modules.insurance.handler;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.insurance.mapper.InsuredApplyMapper;
import org.springframework.stereotype.Component;

/**
 * 保险案件 报案号生成
 *
 * @author HeHui
 * @date 2022-01-03 10:15
 */
@Component
@Slf4j
public class InsuranceCaseIdGenerate {

    private final InsuredApplyMapper applyMapper;
    private final Snowflake snowflake;

    public InsuranceCaseIdGenerate(InsuredApplyMapper applyMapper) {
        this.applyMapper = applyMapper;
        snowflake = IdUtil.createSnowflake(0, 0);
    }

    public String generate(String pre) {
        return snowflake.nextIdStr();
    }
}
